import Vue from "vue"
import Router from "vue-router"

Vue.use(Router)

const router = new Router({
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: "login",
      component: () => import("@/views/login/index.vue"),
      meta: {
        title: '登录',
        // keepAlive: true
      }
    },
    {
      path: '/',
      name: "mine",
      component: () => import("@/views/mine/index.vue"),
      meta: {
        title: '登录',
        // keepAlive: true
      },

      children: [
        { path: '/mine', redirect: '/mine/customerManagement' },

        {
          path: '/mine/customerManagement',
          name: "customerManagement",
          component: () =>
            import("@/views/mine/components/customerManagement"),
          meta: {
            title: "客户管理",
            //  keepAlive: true
          }, children: [

          ]
        },]

    }, 
    {
      path: '/login',
      name: "login",
      component: () => import("@/views/login/index.vue"),
      meta: {
        title: '登录',
        // keepAlive: true
      }
    },{
      path: '/register',
      name: "register",
      component: () => import("@/views/login/register.vue"),
      meta: {
        title: '注册',
        // keepAlive: true
      }
    }, {
      path: '/forgetpassword',
      name: "forgetpassword",
      component: () => import("@/views/login/forgetpassword.vue"),
      meta: {
        title: '忘记密码',
        // keepAlive: true
      }

    },
    {
      path: '/mine',
      name: "mine",
      component: () => import("@/views/mine/index.vue"),
      meta: {
        title: '我的',
        // keepAlive: true
      },
      children: [
        { path: '/mine', redirect: '/mine/customerManagement' },

        {
          path: '/mine/customerManagement',
          name: "customerManagement",
          component: () =>
            import("@/views/mine/components/customerManagement"),
          meta: {
            title: "客户管理",
            //  keepAlive: true
          }, children: [

          ]
        },
        {
          path: '/mine/addoredit',
          name: "addoredit",
          component: () =>
            import("@/views/mine/components/addoredit"),
          meta: {
            title: "添加或编辑新客户",
            //  keepAlive: true
          }
        },

        {
          path: '/mine/myIntegral',
          name: "myIntegral",
          component: () =>
            import("@/views/mine/components/myIntegral"),
          meta: {
            title: "我的积分",
            //  keepAlive: true
          },
          children: [
            { path: '/mine/myIntegral', redirect: '/mine/myIntegralcontent' },
            {
              path: '/mine/myIntegralcontent',
              name: "myIntegralcontent",
              component: () =>
                import("@/views/mine/components/myIntegralcontent"),
              meta: {
                title: "我的积分",
                //  keepAlive: true
              }
            },
            {
              path: '/mine/exchangerecord',
              name: "exchangerecord",
              component: () =>
                import("@/views/mine/components/exchangerecord"),
              meta: {
                title: "商品兑换记录",
                //  keepAlive: true
              }
            },
            {
              path: '/mine/voucher',
              name: "voucher",
              component: () =>
                import("@/views/mine/components/voucher"),
              meta: {
                title: "代金券",
                //  keepAlive: true
              }
            },
            {
              path: '/mine/cashList',
              name: "cashList",
              component: () =>
                import("@/views/mine/components/cashList"),
              meta: {
                title: "现金兑换记录",
                //  keepAlive: true
              }
            },
          ]

        },

        {
          path: '/mine/personalData',
          name: "personalData",
          component: () =>
            import("@/views/mine/components/personalData"),
          meta: {
            title: "个人资料",
            //  keepAlive: true
          }
        },
      ]
    },
    {
      path: '/mallIntegral',
      name: "mallIntegral",
      component: () => import("@/views/mallIntegral/index.vue"),
      meta: {
        title: '积分商城',
        // keepAlive: true
      }
    },
    {
      path: '/newDetail',
      name: "newDetail",
      component: () => import("@/views/mine/newDetail.vue"),
      meta: {
        title: '消息/提醒详情',
        // keepAlive: true
      }
    },









  ]
})



export default router